﻿using University.Workshop.Business;

namespace University.Workshop.Presenters.Square.Show
{
    
public class PresenterShowSquare
    {
        IShowSquareBasicView viewRegisterBasic;
        IShowSquareView view;
        public PresenterShowSquare(IShowSquareView View, Model.Square square)
        {
            view = View;
            Square=ManagerSquare.GetSquareById(square);
        }

        public void GoStepTwo()
        {
                view.CallSecondPage();
            ProcedureAfterCall();
        }

        public void GoBackPage()
        {
            viewRegisterBasic.GoBackPage();
        }

        public void GoNextPage()
        {
            viewRegisterBasic.GoNextPage();
        }
        public void GoStepOne()
        {
            view.CallFirstPage();
            ProcedureAfterCall();
        }

        private void ProcedureAfterCall()
        {
            viewRegisterBasic = view.ShowBasic;
            view.ShowBasic.AllotmentsToShow=ManagerAllotment.GetAllotmentsBySquare(Square);
            view.ShowBasic.SquareToShow=Square;
            view.ShowBasic.UbicationCroquisSquareToShow=ManagerSquare.GetUbicationImage(Square);
            viewRegisterBasic.Update();
        }

        public void FirstTime()
        {
            view.CallFirstPage();
            ProcedureAfterCall();
        }
        public Model.Square Square;

        public void ShowImageSquare()
        {
            string v = ManagerSquare.GetUbicationImage(Square);
            if(!string.IsNullOrEmpty(v))
            view.OpenImage(v);
        }
    }
}
